from django.contrib import admin
from django.contrib.auth.models import User
from .models import UserProfile, EmailVerifyRecord
from django.contrib.auth.admin import UserAdmin

# Register your models here.

admin.site.unregister(User)  # 取消注册用户模型


# 定义用户资料内联类
class UserProfileInline(admin.StackedInline):
    model = UserProfile


# 定义用户资料管理类，包含用户资料内联类
class UserProfileAdmin(UserAdmin):
    inlines = [UserProfileInline]


# 注册用户模型和管理类
admin.site.register(User, UserProfileAdmin)


@admin.register(EmailVerifyRecord)
class Admin(admin.ModelAdmin):
    # 在管理后台注册EmailVerifyRecord模型，并定义显示的字段
    list_display = ['code', ]  # 显示字段

